import {getUserList,getFindUserList} from "@/api"
const state = {
  userInfo:[]
}
const actions = {
  //用户数据列表
  async getUserList({commit},{limit,page}){
    let result = await getUserList(limit,page)
    commit("USERINFO",result.data)
    return result.data
  },
  //搜索关键字模糊查询
  async getFindUser({commit},{key_search,input_value}){
    let result = await getFindUserList(key_search,input_value)
    if(result.status==200){
      commit("FINDUSERLIST",result.data)
    }
  }
}
const mutations = {
  USERINFO(state,value){
    state.userInfo = value.result
  },
  FINDUSERLIST(state,value){
    state.userInfo = value
  }
}
const getters = {
  userInfo:(state)=>state.userInfo||[]
};
export default {
  state,
  actions,
  mutations,
  getters
}